import { cafReq } from "..";
import { QueryParams } from "../request";

export const baseURL = `${import.meta.env.VITE_REQ_URL}:30006`;

/**
 * 根据ID查询
 * @param {object} params PageParamTransactionProcessQuery
 * @param {number} params.pageIndex
 * @param {number} params.pageSize
 * @param {object} params.condition
 * @param {array} params.sorts
 * @returns
 */
export const queryPage = async (params: QueryParams) => {
  return await cafReq(0, { baseURL }).post(
    `/purchase-receipt/cost/transaction/process/v1/query`,
    params
  );
};
/**
 * 根据ID查询
 * @param {object} params PageParamTransactionProcessQuery
 * @param {number} params.pageIndex
 * @param {number} params.pageSize
 * @param {object} params.condition
 * @param {array} params.sorts
 * @returns
 */
export const queryDynamicPage = async (params: QueryParams) => {
  return await cafReq(0, { baseURL }).post(
    `/purchase-receipt/cost/transaction/process/v1/query1`,
    params
  );
};
/**
 * 根据ID查询
 * @param {string} businessId 业务主键
 * @returns
 */
export const queryJournalEntriesByBusinessId = async (
  businessId: number | string,
  params?: object
) => {
  return await cafReq(0, { baseURL }).get(
    `/purchase-receipt/cost/journal/entry/v1/query/${businessId}`,
    { params }
  );
};
/**
 *
 */
export const getExcel1 = async (config: any) => {
  return await cafReq(1, { needOrigin: true, baseURL }).get(
    `/purchase-receipt/export/excel1`,
    config
  );
};
/**
 *
 */
export const getExcel2 = async (config: any) => {
  return await cafReq(1, { needOrigin: true, baseURL }).get(
    `/purchase-receipt/export/excel2`,
    config
  );
};
